<?php
defined('_JEXEC') or die( 'Restricted access' );

class igprofileModeladd_edit_profile extends igbaseModel
{
	protected $_data = null;
	protected $context = 'edit_profile';

	function __construct()
	{
		parent::__construct();
	}

	function &getData()
	{
		if(!$this->_loadData())
		{
			$this->_initData();
		}

		return $this->_data;
	}

    function _loadData()
	{
		if (empty($this->_data))
		{
			$query = 'SELECT * FROM #__igallery_profiles WHERE id = '. (int)$this->_id;
			$this->_db->setQuery($query);
			$this->_data = $this->_db->loadObject();

			return (boolean) $this->_data;
		}
		return true;
	}

	function _initData()
	{
		if (empty($this->_data))
		{
			$profile = new stdClass();

			//not on tab
			$profile->id = null;
			$profile->ordering = null;

			//general
			$profile->name = null;
			$profile->img_quality = 80;
			$profile->show_search = 0;
			$profile->show_cat_title = 0;
			$profile->published = 1;
			$profile->refresh_mode = 'javascript';
			$profile->round_large = 0;
			$profile->round_thumb = 0;
			$profile->round_menu = 0;
			$profile->round_fill = 'FFFFFF';
			$profile->watermark = 0;
			$profile->watermark_position = 'right_bottom';
			$profile->watermark_text = null;
			$profile->watermark_transparency = 100;
			$profile->watermark_filename = null;
			$profile->watermark_text_color = '255,255,255';
			$profile->watermark_text_size = 16;

			//menu
			$profile->menu_max_width = 200;
			$profile->menu_max_height = 150;
			$profile->crop_menu = 1;
			$profile->menu_image_defaults = 1;
			$profile->columns = 2;
			$profile->menu_pagination = 0;
			$profile->menu_pagination_amount = 20;

			//main image
			$profile->show_large_image = 1;
			$profile->max_width = 600;
			$profile->max_height = 400;
			$profile->crop_main = 0;
			$profile->img_container_height = 0;
			$profile->img_container_width = 0;
			$profile->fade_duration = 50;
			$profile->preload = 1;
			$profile->magnify = 1;

			//thumbs
			$profile->show_thumbs = 1;
			$profile->thumb_width = 90;
			$profile->thumb_height = 90;
			$profile->crop_thumbs = 1;
			$profile->thumb_position = 'below';
			$profile->thumb_container_width = 0;
			$profile->thumb_container_height = 0;
			$profile->images_per_row = 0;
			$profile->thumb_scrollbar = 0;
			$profile->arrows_up_down = 0;
			$profile->arrows_left_right = 1;
			$profile->scroll_speed = 0.2;
			$profile->scroll_boundary = 150;
			$profile->thumb_pagination = 0;
			$profile->thumb_pagination_amount = 20;

			//other
			$profile->gallery_des_position = 'below';
			$profile->allow_comments = 0;
			$profile->allow_rating = 0;
			$profile->align = 'left';
			$profile->style = 'plain';
			$profile->show_slideshow_controls = 0;
			$profile->slideshow_autostart = 0;
			$profile->slideshow_pause = 3000;
			$profile->show_descriptions = 1;
			$profile->photo_des_position = 'below';
			$profile->photo_des_width = 0;
			$profile->photo_des_height = 0;
			$profile->download_image = 'none';
			$profile->show_tags = 0;
			$profile->share_facebook = 0;
			$profile->report_image = 0;
			$profile->lbox_report_image = 0;

			//lightbox
			$profile->lightbox = 1;
			$profile->lbox_max_width = 800;
			$profile->lbox_max_height = 600;
			$profile->crop_lbox = 0;
			$profile->lbox_img_container_height = 0;
			$profile->lbox_img_container_width = 0;
			$profile->lbox_fade_duration = 50;
			$profile->lbox_preload = 1;

			//lightbox thumbs
			$profile->lbox_show_thumbs = 1;
			$profile->lbox_thumb_width = 100;
			$profile->lbox_thumb_height = 100;
			$profile->lbox_crop_thumbs = 1;
			$profile->lbox_thumb_position = 'below';
			$profile->lbox_thumb_container_width = 0;
			$profile->lbox_thumb_container_height = 0;
			$profile->lbox_images_per_row = 0;
			$profile->lbox_thumb_scrollbar = 0;
			$profile->lbox_arrows_up_down = 0;
			$profile->lbox_arrows_left_right = 1;
			$profile->lbox_scroll_speed = 0.2;
			$profile->lbox_scroll_boundary = 150;

			//lightbox other
			$profile->lbox_allow_comments = 0;
			$profile->lbox_allow_rating = 0;
			$profile->lbox_close_position = 'below';
			$profile->lbox_scalable = 0;
			$profile->lbox_show_slideshow_controls = 0;
			$profile->lbox_slideshow_autostart = 0;
			$profile->lbox_slideshow_pause = 3000;
			$profile->lbox_show_descriptions = 1;
			$profile->lbox_photo_des_position = 'below';
			$profile->lbox_photo_des_width = 0;
			$profile->lbox_photo_des_height = 0;
			$profile->lbox_download_image = 'none';
			$profile->lbox_show_tags = 0;
			$profile->lbox_share_facebook = 0;

			$profile->acl_cat_menu = 2;
			$profile->acl_cat_display = 2;
			$profile->acl_cat_view = 1;
			$profile->acl_cat_edit = 1;
			$profile->acl_cat_delete = 1;
			$profile->acl_cat_publish = 1;
			$profile->acl_cat_order = 1;
			$profile->acl_upload = 1;
			$profile->acl_photo_view = 1;
			$profile->acl_photo_edit = 1;
			$profile->acl_photo_del = 1;
			$profile->acl_photo_publish = 1;
			$profile->acl_photo_ordering = 1;

			$this->_data					= $profile;
			return (boolean) $this->_data;
		}
		return true;
	}
}